import axios from 'axios'
import {store} from '../redux/store'
import {lodingAction} from '../redux/actions/tabswitch'
axios.defaults.baseURL = "http://localhost:8000"

axios.interceptors.request.use((config) => {
  store.dispatch(lodingAction(true))
  return config
}, (err) => {
  return Promise.reject(err)
})

axios.interceptors.response.use((res) => {
  store.dispatch(lodingAction(false))
  return res
}, (err) => {
  return Promise.reject(err)
})